package com.youdoneed.community.forum.web;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.youdoneed.community.common.vo.ResultMessage;
import com.youdoneed.community.forum.entity.Forummessagelabel;
import com.youdoneed.community.forum.service.ForumuserattentionmessagelabelrelService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 个人关注标签记控制器
 *
 * @author lid
 * @date 2017.6.15
 */
@SuppressWarnings("unchecked")
@RestController
@RequestMapping(value = "/forumuserattentionlabel", method = {RequestMethod.GET, RequestMethod.POST})
@Api(value = "个人关注标签记录控制器", description = "个人关注标签记录相关操作")
public class ForumuserattentionmessagelabelrelController {

    private static final Logger logger = LoggerFactory.getLogger(ForumuserattentionmessagelabelrelController.class);

    @Autowired
    ForumuserattentionmessagelabelrelService service;

    @RequestMapping(value = "/getUserAttentionLabelsByUserId", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(notes = "根据userId获取当前用户关注的标签", value = "根据userId获取当前用户关注的标签")
    public ResultMessage<List<Forummessagelabel>> getUserAttentionLabelsByUserId(String userId) {
        logger.info("个人关注标签记录控制器,getUserAttentionLabelsByUserId!");
        List<Forummessagelabel> listForummessagelabel = service.getUserAttentionLabelsByUserId(userId);
        if (null == listForummessagelabel) {
            return ResultMessage.newFailure("根据userId获取当前用户关注的标签失败！");
        }
        return ResultMessage.newSuccess("根据userId获取当前用户关注的标签成功！").setData(listForummessagelabel);

    }
}
